package com.gfeeling.guava.test;

import java.util.concurrent.TimeUnit;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;

public class StringGuava {
	public static void main(String[] args) {
		Cache<String, User> cahce=CacheBuilder.newBuilder()
				.expireAfterAccess(8, TimeUnit.SECONDS).maximumSize(10)
				.build(new CacheLoader<String, User>() {  
	        @Override  
	        public User load(String key) throws Exception {  
	        	User b=new User(key, key);  
	            return b;  
	        }  
	    });  
	}
}
class User{
	public String name;
	public String password;
	public User(String name, String password) {
		super();
		this.name = name;
		this.password = password;
	}
}
